Optimal. Leaf size=144 \[ \frac {a^2 (4 A+5 B) \tan (c+d x)}{3 d}+\frac {a^2 (7 A+8 B) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {a^2 (5 A+4 B) \tan (c+d x) \sec ^2(c+d x)}{12 d}+\frac {a^2 (7 A+8 B) \tan (c+d x) \sec (c+d x)}{8 d}+\frac {A \tan (c+d x) \sec ^3(c+d x) \left (a^2 \cos (c+d x)+a^2\right )}{4 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.30, antiderivative size = 144, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 8, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {2975, 2968, 3021, 2748, 3768, 3770, 3767, 8} \[ \frac {a^2 (4 A+5 B) \tan (c+d x)}{3 d}+\frac {a^2 (7 A+8 B) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {a^2 (5 A+4 B) \tan (c+d x) \sec ^2(c+d x)}{12 d}+\frac {a^2 (7 A+8 B) \tan (c+d x) \sec (c+d x)}{8 d}+\frac {A \tan (c+d x) \sec ^3(c+d x) \left (a^2 \cos (c+d x)+a^2\right )}{4 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2748
Rule 2968
Rule 2975
Rule 3021
Rule 3767
Rule 3768
Rule 3770
Rubi steps
\begin {align*} \int (a+a \cos (c+d x))^2 (A+B \cos (c+d x)) \sec ^5(c+d x) \, dx &=\frac {A \left (a^2+a^2 \cos (c+d x)\right ) \sec ^3(c+d x) \tan (c+d x)}{4 d}+\frac {1}{4} \int (a+a \cos (c+d x)) (a (5 A+4 B)+2 a (A+2 B) \cos (c+d x)) \sec ^4(c+d x) \, dx\\ &=\frac {A \left (a^2+a^2 \cos (c+d x)\right ) \sec ^3(c+d x) \tan (c+d x)}{4 d}+\frac {1}{4} \int \left (a^2 (5 A+4 B)+\left (2 a^2 (A+2 B)+a^2 (5 A+4 B)\right ) \cos (c+d x)+2 a^2 (A+2 B) \cos ^2(c+d x)\right ) \sec ^4(c+d x) \, dx\\ &=\frac {a^2 (5 A+4 B) \sec ^2(c+d x) \tan (c+d x)}{12 d}+\frac {A \left (a^2+a^2 \cos (c+d x)\right ) \sec ^3(c+d x) \tan (c+d x)}{4 d}+\frac {1}{12} \int \left (3 a^2 (7 A+8 B)+4 a^2 (4 A+5 B) \cos (c+d x)\right ) \sec ^3(c+d x) \, dx\\ &=\frac {a^2 (5 A+4 B) \sec ^2(c+d x) \tan (c+d x)}{12 d}+\frac {A \left (a^2+a^2 \cos (c+d x)\right ) \sec ^3(c+d x) \tan (c+d x)}{4 d}+\frac {1}{3} \left (a^2 (4 A+5 B)\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{4} \left (a^2 (7 A+8 B)\right ) \int \sec ^3(c+d x) \, dx\\ &=\frac {a^2 (7 A+8 B) \sec (c+d x) \tan (c+d x)}{8 d}+\frac {a^2 (5 A+4 B) \sec ^2(c+d x) \tan (c+d x)}{12 d}+\frac {A \left (a^2+a^2 \cos (c+d x)\right ) \sec ^3(c+d x) \tan (c+d x)}{4 d}+\frac {1}{8} \left (a^2 (7 A+8 B)\right ) \int \sec (c+d x) \, dx-\frac {\left (a^2 (4 A+5 B)\right ) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=\frac {a^2 (7 A+8 B) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {a^2 (4 A+5 B) \tan (c+d x)}{3 d}+\frac {a^2 (7 A+8 B) \sec (c+d x) \tan (c+d x)}{8 d}+\frac {a^2 (5 A+4 B) \sec ^2(c+d x) \tan (c+d x)}{12 d}+\frac {A \left (a^2+a^2 \cos (c+d x)\right ) \sec ^3(c+d x) \tan (c+d x)}{4 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 1.26, size = 262, normalized size = 1.82 \[ -\frac {a^2 (\cos (c+d x)+1)^2 \sec ^4\left (\frac {1}{2} (c+d x)\right ) \sec ^4(c+d x) \left (24 (7 A+8 B) \cos ^4(c+d x) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )\right )-\sec (c) (-24 (4 A+5 B) \sin (c)+3 (15 A+8 B) \sin (d x)+45 A \sin (2 c+d x)+128 A \sin (c+2 d x)+21 A \sin (2 c+3 d x)+21 A \sin (4 c+3 d x)+32 A \sin (3 c+4 d x)+24 B \sin (2 c+d x)+136 B \sin (c+2 d x)-24 B \sin (3 c+2 d x)+24 B \sin (2 c+3 d x)+24 B \sin (4 c+3 d x)+40 B \sin (3 c+4 d x))\right )}{768 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.63, size = 145, normalized size = 1.01 \[ \frac {3 \, {\left (7 \, A + 8 \, B\right )} a^{2} \cos \left (d x + c\right )^{4} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (7 \, A + 8 \, B\right )} a^{2} \cos \left (d x + c\right )^{4} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (8 \, {\left (4 \, A + 5 \, B\right )} a^{2} \cos \left (d x + c\right )^{3} + 3 \, {\left (7 \, A + 8 \, B\right )} a^{2} \cos \left (d x + c\right )^{2} + 8 \, {\left (2 \, A + B\right )} a^{2} \cos \left (d x + c\right ) + 6 \, A a^{2}\right )} \sin \left (d x + c\right )}{48 \, d \cos \left (d x + c\right )^{4}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.87, size = 212, normalized size = 1.47 \[ \frac {3 \, {\left (7 \, A a^{2} + 8 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (7 \, A a^{2} + 8 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (21 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 24 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 77 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 88 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 83 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 136 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 75 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 72 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{4}}}{24 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.16, size = 187, normalized size = 1.30 \[ \frac {7 a^{2} A \sec \left (d x +c \right ) \tan \left (d x +c \right )}{8 d}+\frac {7 a^{2} A \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8 d}+\frac {5 B \,a^{2} \tan \left (d x +c \right )}{3 d}+\frac {4 a^{2} A \tan \left (d x +c \right )}{3 d}+\frac {2 a^{2} A \left (\sec ^{2}\left (d x +c \right )\right ) \tan \left (d x +c \right )}{3 d}+\frac {B \,a^{2} \sec \left (d x +c \right ) \tan \left (d x +c \right )}{d}+\frac {B \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {a^{2} A \left (\sec ^{3}\left (d x +c \right )\right ) \tan \left (d x +c \right )}{4 d}+\frac {B \,a^{2} \tan \left (d x +c \right ) \left (\sec ^{2}\left (d x +c \right )\right )}{3 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.69, size = 230, normalized size = 1.60 \[ \frac {32 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} A a^{2} + 16 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} B a^{2} - 3 \, A a^{2} {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{3} - 5 \, \sin \left (d x + c\right )\right )}}{\sin \left (d x + c\right )^{4} - 2 \, \sin \left (d x + c\right )^{2} + 1} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 12 \, A a^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 24 \, B a^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 48 \, B a^{2} \tan \left (d x + c\right )}{48 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.68, size = 183, normalized size = 1.27 \[ \frac {\left (-\frac {7\,A\,a^2}{4}-2\,B\,a^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (\frac {77\,A\,a^2}{12}+\frac {22\,B\,a^2}{3}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (-\frac {83\,A\,a^2}{12}-\frac {34\,B\,a^2}{3}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (\frac {25\,A\,a^2}{4}+6\,B\,a^2\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+6\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}+\frac {2\,a^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (\frac {7\,A}{8}+B\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________